package com.wgy.day8;

/**
 * Created by pc on 2020/11/4 21:50
 * Description: Demo
 */
public class demo01Methodoverload {
    public static void main(String[] args) {
        System.out.println(sum(10, 20));
        System.out.println(sum(10, 20, 30));
        System.out.println(sum(10, 20, 30, 40));
        /*System.out.println(sum(10, 20, 30, 40, 50));*/ // 错误写法，下面的方法没有对的上的
    }

    public static int sum(int a, int b) {
        return a + b;
    }

    public static int sum(int a, int b, int c) {
        return a + b + c;
    }

    public static int sum(int a, int b, int c, int d) {
        return a + b + c + d;
    }

}
